package com.lyrcsoft.controller;

import com.lyrcsoft.model.po.User;
import com.lyrcsoft.repository.UserRepository;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

//@RestController
//@RequestMapping("/user")
public class UserController {
    @Resource
    private UserRepository userRepository;

    @RequestMapping("/getAllUser")
    public Flux<User> getAllUser() {
        return userRepository.findAll();
    }

    @RequestMapping("/addUser")
    public Mono<User> addUser(User user) {
        return userRepository.save(user);
    }
}
